
  Page({
    data: {
      openid: '',
    },
    onLoad: function () {
     this.getOpenid();
    },
   // 获取用户openid
   getOpenid() {
    let that = this;
    wx.cloud.callFunction({
     name: 'getOpenid',
     complete: res => {
      console.log('云函数获取到的openid: ', res.result.openId)
      var openid = res.result.openId;
      that.setData({
       openid: openid
      })
     }
    })
   }
  })